package net.minecraft.src;

import java.util.ArrayList;
import java.util.ListIterator;
import java.util.Arrays;

public class TileReceiverTransmitterCommon extends TileEntity
{

    public String stampKey[] =
    {
        "", "", "", ""
    };
    public int lineBeingEdited;
    protected boolean isEditable;

    public TileReceiverTransmitterCommon()
    {
        lineBeingEdited = -1;
        isEditable = true;
    }
    public String[] getTileStringArray()
    {
    	return stampKey;
    }
    public String getTileString()
    {
    	String  code;
    	code = stampKey[ 0 ]; 
    	code += stampKey[ 1 ];
    	code += stampKey[ 2 ];
    	code += stampKey[ 3 ];
    	
    	return  code;
    }
    
    public void setTileString(String[] tileString)
    {
    	stampKey = tileString;
    }
    public void writeToNBT(NBTTagCompound nbttagcompound)
    {

        super.writeToNBT(nbttagcompound);
        nbttagcompound.setString("Text1", stampKey[0]);
        nbttagcompound.setString("Text2", stampKey[1]);
        nbttagcompound.setString("Text3", stampKey[2]);
        nbttagcompound.setString("Text4", stampKey[3]);
    
    }
    
    public void readFromNBT(NBTTagCompound nbttagcompound)
    {
        isEditable = false;
        super.readFromNBT(nbttagcompound);
        for (int i = 0; i < 4; i++)
        {
        	stampKey[i] = nbttagcompound.getString((new StringBuilder()).append("Text").append(i + 1).toString());
            if (stampKey[i].length() > 15)
            {
            	stampKey[i] = stampKey[i].substring(0, 15);
            }
        }
    }
    public static  int[] concat(int[] first, int[] second) 
    {
    	  int[] result = Arrays.copyOf(first, first.length + second.length);
    	  System.arraycopy(second, 0, result, first.length, second.length);
    	  return result;
    }

    public void loadFromPacket( Packet230ModLoader packet )
    {

        stampKey  = packet.dataString;
  
    }
    
    public void saveIntoPacket( Packet230ModLoader packet )
    {
        packet.dataString = stampKey;
        packet.packetType = mod_AsPj.idReceiverPacket;

        int[] dataInt = new int[3];
        dataInt[0] = xCoord;
        dataInt[1] = yCoord;
        dataInt[2] = zCoord;
        packet.dataInt = dataInt;	
    }
    
}
